package SmallDataset;

import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Random;

import vo.User;
import JDBC.DatabaseDao;
import Utils.Constants;
import Utils.FileUtils;
import dao.StatusDao;
import dao.UserDao;

public class Test {

	// 查看用户排名
	public static void getTopUsers(String fileName, int topNumber) {
		String result = "";
		String fileContent = FileUtils.readFile(fileName, Constants.FILE_ENCODING);
		String lines[] = fileContent.split(Constants.LINE_SEPERATOR);
		for (int i = 0; i < topNumber; i++) {
			String userId = lines[i].split(Constants.HASH_SEPERATOR)[0];
			User user = UserDao.getById(userId);
			// result += user.getVerified() + "," + user.getName() + "," +
			// user.getFollowsCount() + "," + user.getStatusesCount() + "\n";
			result += user.getName() + "\n";
		}
		System.out.println(result);
	}

	public static void main(String args[]) {
		/*
		 * 生成数据集,计算活跃度（计算微博时间参数）,计算内容值（计算长度，计算个数）,计算稳定值,计算可信度
		 */
		// Init.randomDataset();

		// ReliabilityRanking.computeUserIdReliability();

		// ContentRanking.computeUserIdStatusCounts();
		// ContentRanking.computeUserIdStatusLengths();
		// ContentRanking.computeUserIdContent();

		// ActivityRanking.computeUserIdActivity();

		// getTopUsers(Constants.USERID_ACTIVITY_PATH, 20);
		// getTopUsers(Constants.USERID_STABILITY_PATH, 20);
		// getTopUsers(Constants.USERID_CONTENT_PATH, 30);
		// getTopUsers(Constants.USERID_RELIABILITY_PATH, 20);
//		getTopUsers(Constants.USERID_BORDA_PATH, 20);

		// avgStatuses();
	}
}
